<!DOCTYPE html>












  


<html class="theme-next mist use-motion" lang="zh-CN">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2"/>
<meta name="theme-color" content="#222">






  
  
    
    
  <script src="/lib/pace/pace.min.js?v=1.0.2"></script>
  <link href="/lib/pace/pace-theme-center-atom.min.css?v=1.0.2" rel="stylesheet">







<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />



















  
  
  
  

  

  

  

  

  

  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=6.3.0" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=6.3.0">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=6.3.0">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=6.3.0">


  <link rel="mask-icon" href="/images/logo.svg?v=6.3.0" color="#222">









<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    version: '6.3.0',
    sidebar: {"position":"left","width":260,"display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":true},
    fancybox: false,
    fastclick: false,
    lazyload: false,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>


  




  <meta name="description" content="在macOS上进行zsh的安装及其插件的安装和配置（适用于Ubuntu）">
<meta name="keywords" content="zshrc">
<meta property="og:type" content="article">
<meta property="og:title" content="配置zsh">
<meta property="og:url" content="https://flamywhale.github.io/2018/10/18/zsh-configuration/index.html">
<meta property="og:site_name" content="The Island">
<meta property="og:description" content="在macOS上进行zsh的安装及其插件的安装和配置（适用于Ubuntu）">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="https://flamywhale.github.io/images/201810/iterm-preference.png">
<meta property="og:image" content="https://flamywhale.github.io/images/201810/iterm-zsh.png">
<meta property="og:updated_time" content="2018-12-05T13:43:50.012Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="配置zsh">
<meta name="twitter:description" content="在macOS上进行zsh的安装及其插件的安装和配置（适用于Ubuntu）">
<meta name="twitter:image" content="https://flamywhale.github.io/images/201810/iterm-preference.png">






  <link rel="canonical" href="https://flamywhale.github.io/2018/10/18/zsh-configuration/"/>



<script type="text/javascript" id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  <title>配置zsh | The Island</title>
  









  <noscript>
  <style type="text/css">
    .use-motion .motion-element,
    .use-motion .brand,
    .use-motion .menu-item,
    .sidebar-inner,
    .use-motion .post-block,
    .use-motion .pagination,
    .use-motion .comments,
    .use-motion .post-header,
    .use-motion .post-body,
    .use-motion .collection-title { opacity: initial; }

    .use-motion .logo,
    .use-motion .site-title,
    .use-motion .site-subtitle {
      opacity: initial;
      top: initial;
    }

    .use-motion {
      .logo-line-before i { left: initial; }
      .logo-line-after i { right: initial; }
    }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">The Island</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
    
      
        <p class="site-subtitle">Created at 2018</p>
      
    
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>



<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-home">
    <a href="/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-home"></i> <br />首页</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-archives">
    <a href="/archives/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />归档</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-categories">
    <a href="/categories/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-th"></i> <br />分类</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-tags">
    <a href="/tags/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />标签</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-about">
    <a href="/about/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-user"></i> <br />关于</a>
  </li>

      
      
    </ul>
  

  
    

  

  
</nav>



  



</div>
    </header>

    
  
  
  
    
      
    
    <a href="https://github.com/flamywhale" class="github-corner" target="_blank" title="Follow me on GitHub" aria-label="Follow me on GitHub"><svg width="80" height="80" viewBox="0 0 250 250" style="fill:#222; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg>
    
      </a>
    



    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  
    <div class="reading-progress-bar"></div>
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://flamywhale.github.io/2018/10/18/zsh-configuration/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Wu Jiahao ♡">
      <meta itemprop="description" content="Stay hungry, stay foolish.">
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="The Island">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">配置zsh
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2018-10-18 23:27:21" itemprop="dateCreated datePublished" datetime="2018-10-18T23:27:21+08:00">2018-10-18</time>
            

            
              

              
                
                <span class="post-meta-divider">|</span>
                

                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                
                  <span class="post-meta-item-text">更新于</span>
                
                <time title="修改时间：2018-12-05 21:43:50" itemprop="dateModified" datetime="2018-12-05T21:43:50+08:00">2018-12-05</time>
              
            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/2018年10月/" itemprop="url" rel="index"><span itemprop="name">2018年10月</span></a></span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          
              <div class="post-description">在macOS上进行zsh的安装及其插件的安装和配置（适用于Ubuntu）</div>
          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="配置环境"><a href="#配置环境" class="headerlink" title="配置环境"></a>配置环境</h2><p><code>macOS Majave 10.14</code> 或 <code>Ubuntu 16.04</code></p>
<h2 id="安装zsh"><a href="#安装zsh" class="headerlink" title="安装zsh"></a>安装<code>zsh</code></h2><ol>
<li><p>查看系统中是否已经有 <code>zsh</code></p>
 <figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cat /etc/shells | grep <span class="string">"zsh"</span></span><br></pre></td></tr></table></figure>
<p> 如果没有结果显示，表明系统中没有 <code>zsh</code> ，则进行下一步的安装。</p>
</li>
<li><p>安装 <code>zsh</code></p>
 <figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">(macOS)  brew install zsh</span><br><span class="line">(Ubuntu) sudo apt install zsh</span><br></pre></td></tr></table></figure>
<p> <strong>PS</strong>：<code>macOS</code> 系统需要先安装 <code>homebrew</code> 才能使用 <code>brew install</code> 命令；关于 <code>homebrew</code> 的安装请点击<a href="https://brew.sh" target="_blank" rel="noopener">此处</a>。</p>
</li>
</ol>
<h2 id="设置-zsh-为默认-shell"><a href="#设置-zsh-为默认-shell" class="headerlink" title="设置 zsh 为默认 shell"></a>设置 <code>zsh</code> 为默认 <code>shell</code></h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 该命令在重启系统后生效，即将zsh设置为默认shell</span></span><br><span class="line">chsh -s `<span class="built_in">which</span> zsh`</span><br><span class="line"><span class="comment"># 需要输入密码</span></span><br></pre></td></tr></table></figure>
<h2 id="安装-zsh-插件"><a href="#安装-zsh-插件" class="headerlink" title="安装 zsh 插件"></a>安装 <code>zsh</code> 插件</h2><ol>
<li><p>安装 <code>zsh</code> 的插件管理脚本 <code>zsh-antigen</code>（方便插件的统一管理）</p>
 <figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">(macOS)  brew install antigen</span><br><span class="line">(Ubuntu) sudo apt install zsh-antigen</span><br></pre></td></tr></table></figure>
<p> 关于 <code>antigen</code> 详情，请点击<a href="https://github.com/zsh-users/antigen" target="_blank" rel="noopener">此处</a>。</p>
</li>
<li><p>设置 <code>zshrc</code> ，脚本内容如下：</p>
 <figure class="highlight zsh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># ZSH</span></span><br><span class="line">ANTIGEN=/path/to/antigen.zsh</span><br><span class="line"><span class="built_in">source</span> <span class="variable">$&#123;ANTIGEN&#125;</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># PATH</span></span><br><span class="line"><span class="built_in">export</span> PATH=<span class="string">"<span class="variable">$PATH</span>"</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># Term</span></span><br><span class="line"><span class="built_in">export</span> TERM=<span class="string">"xterm-256color"</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># Load the oh-my-zsh's library. （使用oh-my-zsh插件，对zsh的界面进行美化）</span></span><br><span class="line">antigen use oh-my-zsh</span><br><span class="line"></span><br><span class="line"><span class="comment"># Bundles from the default repo (robbyrussell's oh-my-zsh).</span></span><br><span class="line">antigen bundle git</span><br><span class="line">antigen bundle heroku</span><br><span class="line">antigen bundle pip</span><br><span class="line">antigen bundle lein</span><br><span class="line">antigen bundle <span class="built_in">command</span>-not-found</span><br><span class="line"></span><br><span class="line"><span class="comment"># Syntax highlighting bundle.</span></span><br><span class="line">antigen bundle zsh-users/zsh-syntax-highlighting <span class="comment"># 语法高亮插件</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># Code tip</span></span><br><span class="line">antigen bundle zsh-users/zsh-autosuggestions <span class="comment"># 自动补全的建议插件</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># Auto completion</span></span><br><span class="line">antigen bundle zsh-users/zsh-completions <span class="comment"># 自动补全插件</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># Load the theme.</span></span><br><span class="line">antigen theme agnosterzak <span class="comment"># zsh的主题</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># Tell Antigen that you're done.</span></span><br><span class="line">antigen apply <span class="comment"># 应用修改</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># Alias</span></span><br><span class="line"><span class="comment">## -s alias</span></span><br><span class="line"><span class="built_in">alias</span> -s py=python</span><br></pre></td></tr></table></figure>
</li>
<li><p>应用 <code>zshrc</code> 的修改</p>
 <figure class="highlight zsh"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">source</span> ~/.zshrc</span><br></pre></td></tr></table></figure>
</li>
</ol>
<h2 id="色彩配置"><a href="#色彩配置" class="headerlink" title="色彩配置"></a>色彩配置</h2><h3 id="iTerm2-颜色配置"><a href="#iTerm2-颜色配置" class="headerlink" title="iTerm2 颜色配置"></a><code>iTerm2</code> 颜色配置</h3><ol>
<li>下载颜色配置文件<ul>
<li>下载<a href="https://www.iterm2.com/colorgallery" target="_blank" rel="noopener">官方</a>提供的颜色配置。</li>
<li>或者，使用我的颜色配置文件，点击<a href="/codes/flamyWhale.itermcolors">此处</a>下载。</li>
</ul>
</li>
<li>将颜色设置导入<code>iTerm2</code><ul>
<li>打开 <code>iTerm2</code> 偏好设置，找到如下图所示界面，并点按箭头所指的按钮，找到 <code>Import ...</code> 选项，然后导入下载好的配置文件即可。<img src="/images/201810/iterm-preference.png" alt="iTermPreferences" title="iTerm2 偏好设置演示图"></li>
</ul>
</li>
</ol>
<h3 id="oh-my-zsh-主题配置"><a href="#oh-my-zsh-主题配置" class="headerlink" title="oh-my-zsh 主题配置"></a><code>oh-my-zsh</code> 主题配置</h3><ol>
<li>主题选择<ul>
<li>选用 <code>oh-my-zsh</code> 官方提供的主题文件，在 <code>oh-my-zsh</code> 目录下的 <code>themes</code> 文件夹中。</li>
<li>或者，选用我使用的主题，来自于<a href="https://github.com/zakaziko99/agnosterzak-ohmyzsh-theme" target="_blank" rel="noopener">Github</a></li>
</ul>
</li>
<li>将主题文件放入<code>oh-my-zsh</code> 目录下的 <code>themes</code> 文件夹中，然后修改 <code>~/.zshrc</code> ，将主题名设置为对应主题名字（请参见上述 <code>~/.zshrc</code> 配置）。</li>
</ol>
<h2 id="最终效果图"><a href="#最终效果图" class="headerlink" title="最终效果图"></a>最终效果图</h2><p><img src="/images/201810/iterm-zsh.png" alt="效果图" title="界面：macOS iTerm2"></p>
<ul>
<li>PS: 效果图为 <code>macOS</code> 系统下的 <code>iTerm2</code> ，<code>oh-my-zsh</code> 主题为 <code>agnosterzak</code><ul>
<li>关于 <code>iTerm2</code> 的安装，请点击<a href="https://www.iterm2.com" target="_blank" rel="noopener">此处</a>。</li>
</ul>
</li>
</ul>

      
    </div>

    

    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/zshrc/" rel="tag"># zshrc</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2018/10/16/ss-server-build/" rel="next" title="Build ss on a personal server">
                <i class="fa fa-chevron-left"></i> Build ss on a personal server
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2018/11/18/kaoyan-log/" rel="prev" title="考研日常记录">
                考研日常记录 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>


  </div>


          </div>
          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
      <div id="sidebar-dimmer"></div>
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image"
                src="/images/avatar.gif"
                alt="Wu Jiahao ♡" />
            
              <p class="site-author-name" itemprop="name">Wu Jiahao ♡</p>
              <p class="site-description motion-element" itemprop="description">Stay hungry, stay foolish.</p>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/archives/">
                
                    <span class="site-state-item-count">9</span>
                    <span class="site-state-item-name">日志</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-categories">
                  <a href="/categories/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">4</span>
                    <span class="site-state-item-name">分类</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-tags">
                  <a href="/tags/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">8</span>
                    <span class="site-state-item-name">标签</span>
                  </a>
                </div>
              
            </nav>
          

          

          

          
          

          
          

          
            
          
          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#配置环境"><span class="nav-number">1.</span> <span class="nav-text">配置环境</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#安装zsh"><span class="nav-number">2.</span> <span class="nav-text">安装zsh</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#设置-zsh-为默认-shell"><span class="nav-number">3.</span> <span class="nav-text">设置 zsh 为默认 shell</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#安装-zsh-插件"><span class="nav-number">4.</span> <span class="nav-text">安装 zsh 插件</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#色彩配置"><span class="nav-number">5.</span> <span class="nav-text">色彩配置</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#iTerm2-颜色配置"><span class="nav-number">5.1.</span> <span class="nav-text">iTerm2 颜色配置</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#oh-my-zsh-主题配置"><span class="nav-number">5.2.</span> <span class="nav-text">oh-my-zsh 主题配置</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#最终效果图"><span class="nav-number">6.</span> <span class="nav-text">最终效果图</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2018</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Wu Jiahao ♡</span>

  

  
</div>




  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动 v3.7.1</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 – <a class="theme-link" target="_blank" href="https://theme-next.org">NexT.Mist</a> v6.3.0</div>




        








        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    
	
    

    
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>
























  



  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/reading_progress/reading_progress.js"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=6.3.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=6.3.0"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=6.3.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=6.3.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=6.3.0"></script>



  



  










  





  

  

  

  
  

  
  

  


  
  

  

  
  <script type="text/javascript" src="/js/src/js.cookie.js?v=6.3.0"></script>
  <script type="text/javascript" src="/js/src/scroll-cookie.js?v=6.3.0"></script>


  

  

  
  <style>
    .copy-btn {
      display: inline-block;
      padding: 6px 12px;
      font-size: 13px;
      font-weight: 700;
      line-height: 20px;
      color: #333;
      white-space: nowrap;
      vertical-align: middle;
      cursor: pointer;
      background-color: #eee;
      background-image: linear-gradient(#fcfcfc, #eee);
      border: 1px solid #d5d5d5;
      border-radius: 3px;
      user-select: none;
      outline: 0;
    }

    .highlight-wrap .copy-btn {
      transition: opacity .3s ease-in-out;
      opacity: 0;
      padding: 2px 6px;
      position: absolute;
      right: 4px;
      top: 8px;
    }

    .highlight-wrap:hover .copy-btn,
    .highlight-wrap .copy-btn:focus {
      opacity: 1
    }

    .highlight-wrap {
      position: relative;
    }
  </style>
  <script>
    $('.highlight').each(function (i, e) {
      var $wrap = $('<div>').addClass('highlight-wrap')
      $(e).after($wrap)
      $wrap.append($('<button>').addClass('copy-btn').append('复制').on('click', function (e) {
        var code = $(this).parent().find('.code').find('.line').map(function (i, e) {
          return $(e).text()
        }).toArray().join('\n')
        var ta = document.createElement('textarea')
        document.body.appendChild(ta)
        ta.style.position = 'absolute'
        ta.style.top = '0px'
        ta.style.left = '0px'
        ta.value = code
        ta.select()
        ta.focus()
        var result = document.execCommand('copy')
        document.body.removeChild(ta)
        
          if(result)$(this).text('复制成功')
          else $(this).text('复制失败')
        
        $(this).blur()
      })).on('mouseleave', function (e) {
        var $b = $(this).find('.copy-btn')
        setTimeout(function () {
          $b.text('复制')
        }, 300)
      }).append(e)
    })
  </script>


</body>
</html>
